package com.waitingresult.thread.reference;

/**
 * All right reserved,Designed By WangShuai
 *
 * @author : WangShuai
 * @version : V1.0
 * @ClassName : ReferenceDemo
 * @Description : 强软弱虚引用的区别
 * @date : 2022/9/18 16:43
 */
public class ReferenceDemo {
    public static void main(String[] args) {
        //强
         //M m = new M();
    //    System.out.println(m.hashCode());
        //软
//        SoftReference<M> mSoftReference = new SoftReference<>(new M());
//        System.err.println(mSoftReference.get());
//        System.gc();
//        System.err.println(mSoftReference.get());
        //弱
//        WeakReference<M> weakReference = new WeakReference<>(new M());
//        System.err.println(weakReference.get());
//        System.gc();
//        System.err.println(weakReference.get());
        //虚,管理堆外内存，
       // PhantomReference phantomReference = new PhantomReference(new M());

    }
}
